package lt.egidijus.aatest.junit;

import static org.junit.Assert.*;

import java.util.ArrayList;

import junit.framework.Assert;

import lt.egidijus.aatest.generator.TestSuiteGenerator;
import lt.egidijus.aatest.model.AAtestClass;
import lt.egidijus.aatest.model.AAtestList;
import lt.egidijus.aatest.utils.Constants;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.launching.sourcelookup.containers.JavaProjectSourceContainer;
import org.junit.Before;
import org.junit.Test;

public class JUnitFinderTest {
	
	private JUnitFinder finder = null;
	private IJavaProject srcProject = null;
	private IJavaProject testProject = null;

	@Before
	public void setUp() throws Exception {
		finder = new JUnitFinder();
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(Constants.projectName);
		srcProject = JavaCore.create(project);
		IProject project2 = ResourcesPlugin.getWorkspace().getRoot().getProject(Constants.testProjectName);
		testProject = JavaCore.create(project2);
	}
	
	@Test
	public void testFindJUnitsForProject1() {
		try {
			//ArrayList<ICompilationUnit>  list = finder.findJUnitsForProject(srcProject);
		} catch (Exception e) {
			fail(e.getMessage());
		}
	}
	
	@Test
	public void testFindJUnitsForProject2() {
		try {
		//	ArrayList<ICompilationUnit>  list = finder.findJUnitsForProject(testProject);
		} catch (Exception e) {
			fail(e.getMessage());
		}
	}
	
	@Test
	public void testFindJUnitsForProject3() {
		try {
			ArrayList<ICompilationUnit>  list = finder.findJUnitsForProject(srcProject);
			//Assert.assertEquals(list.size(), 71);
		} catch (Exception e) {
			fail(e.getMessage());
		}
	}
	
	@Test
	public void testFindJUnitsForProject4() {
		try {
			ArrayList<ICompilationUnit>  list = finder.findJUnitsForProject(testProject);
		//	Assert.assertEquals(list.size(), 41);
		} catch (Exception e) {
			fail(e.getMessage());
		}
	}


}
